
# 获取脚本所在目录
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path

# 定义相对路径
# $targetDir = "D:\Dwonload\appProject\appProject\simpleDemo\src\main\assets\apps\__UNI__37A3207\www"  # 要删除文件并复制文件的目标目录
$targetDir = "C:\Users\k\Downloads\appProject\appProject\simpleDemo\src\main\assets\apps\__UNI__37A3207\www"  # 要删除文件并复制文件的目标目录
# $sourceDir =  Join-Path -Path $scriptDir -ChildPath "dist\build\app"  # 源目录，即a目录
$sourceDir =  Join-Path -Path $scriptDir -ChildPath "dist\dev\app"  # 源目录，即a目录


# 删除目标目录及其所有内容
try {
    if (Test-Path -Path $targetDir) {
        Remove-Item -Path $targetDir -Recurse -Force
        Write-Host "Deleted: $targetDir and its contents"
    }
} catch {
    Write-Host "Error deleting directory: $_"
}

# 复制源目录及其所有内容到目标目录
try {
    Copy-Item -Path $sourceDir -Destination $targetDir -Recurse -Force
    Write-Host "Copied: $sourceDir to $targetDir"
} catch {
    Write-Host "Error copying directory: $_"
}
